<?php
    class Order_Model extends CI_Model
    {
        var $table = "db_orders";
        function __construct()
        {
            parent::__construct();
        }
        function list_order()
        {
            return $this->db->get($this->table)->result();
        }
        function get_order($id)
        {
            $this->db->where('id_order',$id);
            return $this->db->get($this->table)->row();
        }
        function delete_order($id)
        {
            $this->db->where('id_order',$id);
            if($this->db->delete($this->table)) return true; else return false;
        }
        function update_active($id,$data)
        {
            $this->db->where('id_order',$id);
            $data = array(
                'active' => $data['active']
            );
            $this->db->set($data);
            if($this->db->update($this->table)) return true; else return false;
        }
        
    }
?>